ASensorManager_configureDirectReport

Configure direct report on channel

Configure sensor direct report on a direct channel: set rate to value other than {@link ASENSOR_DIRECT_RATE_STOP} so that sensor event can be directly written into the shared memory region used for creating the buffer. It returns a positive token which can be used for identify sensor events from different sensors on success. Calling with rate {@link ASENSOR_DIRECT_RATE_STOP} will stop direct report of the sensor specified in the channel.

To stop all active sensor direct report configured to a channel, set sensor to NULL and rate to {@link ASENSOR_DIRECT_RATE_STOP}.

In order to successfully configure a direct report, the sensor has to support the specified rate and the channel type, which can be checked by {@link ASensor_getHighestDirectReportRateLevel} and {@link ASensor_isDirectChannelTypeSupported}, respectively.

extern (C) nothrow @nogc
int
ASensorManager_configureDirectReport
(
ASensorManager* manager
,
const(ASensor)* sensor
,,
int rate
)

Examples

ASensorManager *manager = ...; ASensor *sensor = ...; int channelId = ...;

ASensorManager_configureDirectReport(manager, sensor, channel_id, ASENSOR_DIRECT_RATE_FAST);

\param manager the {@link ASensorManager} instance obtained from {@link ASensorManager_getInstanceForPackage}. \param sensor a {@link ASensor} to denote which sensor to be operate. It can be NULL if rate is {@link ASENSOR_DIRECT_RATE_STOP}, denoting stopping of all active sensor direct report. \param channelId channel id (a positive integer) returned from {@link ASensorManager_createSharedMemoryDirectChannel} or {@link ASensorManager_createHardwareBufferDirectChannel}.

\return positive token for success or negative error code.

Meta